package com.sicilin.dao;

import com.sicilin.po.TSysRole;
import com.sicilin.po.TSysRoleAuth;
import com.sicilin.system.role.dto.Role;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public interface RoleDao {
    int saveRole(TSysRole role);

    int existRoleCode(@Param("roleCode") String roleCode,@Param("companyId") int companyId);

    List<Role> searchRoleLimit(@Param("searchText")String searchText, @Param("start")int start, @Param("size") int size,@Param("companyId") int companyId);

    int countSearchRole(@Param("searchText") String searchText,@Param("companyId") int companyId);

    int updateRole(@Param("roleId") int roleId,@Param("roleCode") String roleCode,@Param("roleName")String roleName,@Param("description") String description);

    TSysRole getTSysRoleById (@Param("roleId") int roleId);

    int addRoleAuth(Collection<TSysRoleAuth> roleAuths);
    int deleteRoleAuthByRoleId(@Param("roleId") int roleId);

    Set<Integer> getRoleAuthIdsByRoleId(@Param("roleId") int roleId);

    Set<TSysRole> filterHigherLevel(@Param("roleIds") Collection<Integer> roleIds,@Param("level") int level);

    List<TSysRole> getRoleByIds(Collection<Integer> roleIds);
}
